<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>阻止默认行为</title>
  </head>
  <body>
    <a href="www.baidu.com" id="jump">跳转</a>
    <script>
      const aEle = document.querySelector('a')

      aEle.addEventListener('click', function () {
        alert('跳你妈呢')
        event.preventDefault()
      })
    </script>
  </body>
</html>
